import scrapy
from example_08.items import SinaItem

class SinaspiderSpider(scrapy.Spider):
    name = "sinaspider"
    
    def start_requests(self):
        urls = [
            'http://sina.com.cn',
            'http://baidu.com'
        ]
        for url in urls:
            yield scrapy.Request(url=url, callback=self.parse)


    def parse(self, response):
        cur_item = SinaItem()
        cur_item['url'] = response.url
        cur_item['title'] =  response.css('title::text').extract_first()
        
        return [cur_item]